<template>
	<view>
		<config-form ref="form" type="fill" :formTemplate="formTemplate" :formValue="formValue" :isCard="true">
		</config-form>
		<view class="p-3">
			<button @click="save" class="cu-btn bg-blue lg block">
				提交
			</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				formTemplate: [{
					formTitle: "填写团队信息",
					id: "469823830580379648",
					object: [
						{
							textName: "name",
							subject: "团队名称",
							controlType: "text",
							isMustfill: true,
							placeholder: "请输入",
							maxlength:50
						},
						{
							textName: "cover",
							subject: "海报",
							controlType: "upload",
							isMustfill: true,
							max: 1,
						},
						{
							textName: "course",
							subject: "不安排日期",
							controlType: "checkbox",
							isMustfill: true,
							values: [{
									valueName: "周日",
									valueCode: 0
								},
								{
									valueName: "周一",
									valueCode: 1
								}, {
									valueName: "周二",
									valueCode: 2
								},
								{
									valueName: "周三",
									valueCode: 3
								},
								{
									valueName: "周四",
									valueCode: 4
								}, {
									valueName: "周五",
									valueCode: 5
								},
								{
									valueName: "周六",
									valueCode: 6
								}
							]
						},
						{
							textName: "interval",
							subject: "值日间隔",
							controlType: "number",
							isMustfill: true,
							placeholder: "请输入",
							maxlength:50,
							unit:'天'
						},
						// {
						// 	textName: "status",
						// 	subject: "是否开启",
						// 	controlType: "switch",
						// 	isMustfill: true,
						// },
					]
				}]
			}
		},
		onLoad() {

		},
		onReady() {
			// this.$refs.form.setRules(this.rules)
		},
		methods: {
			save() {
				let result = this.$refs.form.submit();
				if (result.checkFlag) {
					console.log(result.value);
					uni.showToast({
						title: "验证成功"
					})
				} else {
					uni.showToast({
						title: result.message,
						icon: "none"
					})
				}
			}
		}
	}
</script>

<style>
	@charset "UTF-8";

	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #efeff4;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 14px;
		line-height: inherit;
	}
</style>
